<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<title>Document</title>
		<link rel="stylesheet" href="../../assets/libs/layui/css/layui.css" />
		<link rel="stylesheet" href="../../assets/css/swiper.min.css" />
		<link rel="stylesheet" href="../../assets/css/admin.css" />
		<link rel="stylesheet" href="../../module/formSelects/formSelects-v4.css" />
		<link rel="stylesheet" href="../../assets/css/simditor.css" />
	</head>

	<body>
		<ul class="layui-fixbar">
			<a href="#orange">
				<li class="layui-icon zbyzf"></li>
			</a>
			<a href="#spirit">
				<li class="layui-icon zbyjs"></li>
			</a>
			<a href="#sport">
				<li class="layui-icon zbyyd"></li>
			</a>
			<a href="#sleep">
				<li class="layui-icon zbysm"></li>
			</a>
			<a href="#zbytop">
				<li class="layui-icon layui-icon-top zbyfh"></li>
			</a>
		</ul>

		<a name="zbytop" style="visibility:hidden;"></a>
		<div class="layui-tab layui-tab-brief">
			<div class="layui-row usertitle zbydatdef">
				<div class="layui-col-xs6 layui-col-md6">
					<ul class="layui-tab-title zby_t">
						<li class="layui-this">用户详情</li>
						<li>用户档案</li>
					</ul>
				</div>
				<div class="layui-col-xs3 layui-col-md3 zbydatabc">
					<button class="layui-btn layui-btn-sm layui-btn-primary zbybtn3" onclick="listDay()">最近数据</button>
					<button class="layui-btn layui-btn-sm layui-btn-primary zbybtn2" onclick="nextDate()">
			<i class="layui-icon layui-icon-right"></i>
			</button>
					<div class="layui-input-inline zbyi">
						<input type="text" class="layui-input zbyd" id="test18" placeholder="yyyy-MM-dd">
					</div>
					<button class="layui-btn layui-btn-sm layui-btn-primary zbybtn" onclick="upDate()">
  			<i class="layui-icon layui-icon-left"></i>
			</button>
					<button class="layui-btn layui-btn-sm layui-btn-primary zbybtn4" onclick="todayU()">返回今天</button>

				</div>
				<div class="layui-clear">

				</div>
			</div>

			<div class="layui-tab-content">
				<div class="layui-tab-item zby_it layui-show">
					<br />
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-row layui-col-space20">
								<div class="layui-col-xs1 layui-col-md1">
									<img id="usericon" src="../../assets/images/mrtx.png" width="80px" height="80px" />
								</div>
								<div class="layui-col-xs2 layui-col-md2">
									<div class="layui-card zbyhealth">
										<div class="layui-card-header zbyheader">
											健康值
										</div>
										<div class="layui-card-body">
											<p class="lay-big-font" id="jkva"></p>
										</div>
									</div>
								</div>
								<div class="layui-col-xs6 layui-col-md3">
									<p>
										昵称：<span id="username">莫玄</span>
									</p><br />
									<p>
										设备：<span id="userdivec"></span>
									</p>
								</div>
								<div class="layui-col-xs6 layui-col-md3">
									<p>
										标签：<span></span>
									</p><br />
									<p>
										渠道：<span id="userqd"></span>
									</p>
								</div>
								<div class="layui-col-xs6 layui-col-md3">
									<p>
										用户等级：lv0
									</p><br />
									<p>
										备注：
									</p>
								</div>
							</div>
						</div>
					</div>

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs6 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									脏腑值
								</div>
								<div class="layui-card-body">
									<p class="lay-big-font" id="zfva"></p>
									<div class="layui-progress layui-progress-big" lay-filter="zfp">
										<div class="layui-progress-bar" lay-percent="0%"></div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									精神值
								</div>
								<div class="layui-card-body">
									<p class="lay-big-font" id="jsva"></p>
									<div class="layui-progress layui-progress-big" lay-filter="jsp">
										<div class="layui-progress-bar" lay-percent="0%"></div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									运动值
								</div>
								<div class="layui-card-body">
									<p class="lay-big-font" id="ydva"></p>
									<div class="layui-progress layui-progress-big" lay-filter="ydp">
										<div class="layui-progress-bar" lay-percent="0%"></div>
									</div>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									睡眠值
								</div>
								<div class="layui-card-body">
									<p class="lay-big-font" id="smva"></p>
									<div class="layui-progress layui-progress-big" lay-filter="smp">
										<div class="layui-progress-bar" lay-percent="0%"></div>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card">
								<div class="layui-card-header ">
									状态分析
								</div>
								<div class="layui-card-body zbyz" id="ztfxva">

								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card">
								<div class="layui-card-header">
									分析提示
								</div>
								<div class="layui-card-body zbyy" id="fxtsva">
								</div>
							</div>
						</div>
					</div>
					<br />
					<div class="layui-card">
						<div class="layui-card-header">
							健康趋势分析
						</div>
						<div class="layui-card-body">
							<div id="user_score" class="user_echarts">

							</div>
						</div>
					</div>
					<a name="orange" style="visibility:hidden;"></a>
					<blockquote class="layui-elem-quote">脏腑状态</blockquote>

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card oragne_z">
								<div class="layui-card-header">
									状态分析
								</div>
								<div class="layui-card-body">
									<div class="star bd12">
										<ul>
											<li class="cf">
												<span class="l">脏腑功能：</span>
												<div class="starShow l organs_star0">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">脏腑平衡：</span>
												<div class="starShow l organs_star1">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
										</ul>
									</div>
									<p class="layui-clear"></p>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card oragne_z">
								<div class="layui-card-header">
									风险提示
								</div>
								<div class="layui-card-body">
									<div>
										<ol class="olState_zf">
											<li></li>
										</ol>
									</div>
								</div>
							</div>
						</div>
					</div>
					<br />
					<div class="layui-card">
						<div class="layui-card-header">
							脏腑平衡状态
						</div>
						<div class="layui-card-body">
							<div class="layui-row layui-col-space20">
								<div class="layui-col-xs7 layui-col-md7">
									<div class="unEmpty">
										<div class="organ_radar">
											<div class="cardiac_btn">
												<h2 class="dn"></h2>
												<div class="cf">
													<span></span>
													<b class="dayShow"></b>
													<b class="nowShow on"></b>
													<span></span>
												</div>
											</div>
											<div style="clear: both;"></div>
											<div class="cardiac_day">
												<div class="user_echarts" id="organs0"></div>
											</div>
											<div class="cardiac_now">
												<div class="device">
													<a class="arrow-left" href="#"></a>
													<a class="arrow-right" href="#"></a>
													<div class="swiper-container xue">
														<div class="swiper-wrapper hh">
														</div>
													</div>
													<div class="pagination"></div>
												</div>
											</div>
										</div>
									</div>

								</div>
								<div class="layui-col-xs5 layui-col-md5">
									<table class="layui-hide" id="zfld" lay-filter="demos"></table>
								</div>
							</div>

						</div>
					</div>

					<div class="layui-card">
						<div class="layui-card-header">
							脏腑趋势分析
						</div>
						<div class="layui-card-body">
							<div id="user_organqs" class="user_echarts">

							</div>
						</div>
					</div>

					<div class="layui-card">
						<div class="layui-card-header">
							血压趋势分析
						</div>
						<div class="layui-card-body">
							<div class="layui-row layui-col-space20">
								<div class="layui-col-xs4 layui-col-md4">
									<table class="layui-hide" id="xyl" lay-filter="xuyalx"></table>
								</div>
								<div class="layui-col-xs8 layui-col-md8">
									<div id="user_organxy" class="user_echarts">
									</div>
								</div>
							</div>

						</div>
					</div>

					<a name="spirit" style="visibility:hidden;"></a>
					<blockquote class="layui-elem-quote">精神状态</blockquote>
					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card pirit_z">
								<div class="layui-card-header">
									状态分析
								</div>
								<div class="layui-card-body">
									<div class="star bd12">
										<ul>
											<li class="cf">
												<span class="l">精神节律：</span>
												<div class="starShow l spirit_star0">
													<b></b>
													<!--on/on0-->
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">身心负荷：</span>
												<div class="starShow l spirit_star1">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">精神压力：</span>
												<div class="starShow l spirit_star2">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">疲劳指数：</span>
												<div class="starShow l spirit_star3">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
										</ul>
									</div>
									<p class="layui-clear"></p>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card pirit_z">
								<div class="layui-card-header">
									风险提示
								</div>
								<div class="layui-card-body">
									<div>
										<ol class="olState">
											<li></li>
										</ol>
									</div>
								</div>
							</div>
						</div>
					</div><br />

					<div class="layui-card">
						<div class="layui-card-header">
							精神状态分析
						</div>
						<div class="layui-card-body">

							<div class="layui-row layui-col-space20">
								<div class="layui-col-xs7 layui-col-md7">
									<div id="user_spiritqs" class="user_echarts">

									</div>
								</div>
								<div class="layui-col-xs5 layui-col-md5">
									<table class="layui-hide" id="jsl" lay-filter="jsls"></table>
								</div>
							</div>
						</div>
					</div>

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs3 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									睡眠基础心率
								</div>
								<div class="layui-card-body xlf" id="smjcxl">
								</div>
							</div>
							<div class="layui-card">
								<div class="layui-card-header">
									日间平均心率
								</div>
								<div class="layui-card-body xlf" id="rjpjxl">
								</div>
							</div>
							<div class="layui-card">
								<div class="layui-card-header">
									昼夜心率差
								</div>
								<div class="layui-card-body xlf" id="zyxlc">
								</div>
							</div>
						</div>
						<div class="layui-col-xs9 layui-col-md9">
							<div class="layui-card">
								<div class="layui-card-header">
									昼夜节律
								</div>
								<div class="layui-card-body">
									<div id="user_spiritzy" class="user_echarts"></div>
								</div>
							</div>

						</div>
					</div><br />

					<div class="layui-card">
						<div class="layui-card-header">
							昼夜节律趋势分析
						</div>
						<div class="layui-card-body">
							<div id="user_spiritzyqs" class="user_echarts">

							</div>
						</div>
					</div>

					<a name="sport" style="visibility:hidden;"></a>
					<blockquote class="layui-elem-quote">运动状态</blockquote>

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card sport_z">
								<div class="layui-card-header">
									状态分析
								</div>
								<div class="layui-card-body">
									<div class="star bd12">
										<ul>
											<li class="cf">
												<span class="l">运动时段：</span>
												<div class="starShow l sport_star1">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">运动总量：</span>
												<div class="starShow l sport_star2">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">运动强度：</span>
												<div class="starShow l sport_star3">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
										</ul>
									</div>
									<p class="layui-clear"></p>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card sport_z">
								<div class="layui-card-header">
									风险提示
								</div>
								<div class="layui-card-body">
									<div>
										<ol class="olState_yd">
											<li></li>
										</ol>
									</div>
								</div>
							</div>
						</div>
					</div><br />

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs9 layui-col-md9">
							<div class="layui-card">
								<div class="layui-card-header">
									运动状态个心率统计
								</div>
								<div class="layui-card-body">
									<div id="user_ssporttj" class="user_echarts">

									</div>
								</div>
							</div>
						</div>
						<div class="layui-col-xs3 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									总步数
								</div>
								<div class="layui-card-body xlf" id="zbs">
								</div>
							</div>
							<div class="layui-card">
								<div class="layui-card-header">
									有效运动时长
								</div>
								<div class="layui-card-body xlf" id="yxydsc">
								</div>
							</div>
							<div class="layui-card">
								<div class="layui-card-header">
									有效运动步数
								</div>
								<div class="layui-card-body xlf" id="yxydbs">
								</div>
							</div>
						</div>
					</div><br />

					<div class="layui-card">
						<div class="layui-card-header">
							运动趋势分析
						</div>
						<div class="layui-card-body">
							<div id="user_sportqs" class="user_echarts">

							</div>
						</div>
					</div>

					<a name="sleep" style="visibility:hidden;"></a>
					<blockquote class="layui-elem-quote">睡眠状态</blockquote>

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card pirit_z">
								<div class="layui-card-header">
									状态分析
								</div>
								<div class="layui-card-body">
									<div class="star bd12">
										<ul>
											<li class="cf">
												<span class="l">睡眠时间：</span>
												<div class="starShow l sleep_star0">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">睡眠时长：</span>
												<div class="starShow l sleep_star1">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">睡眠质量：</span>
												<div class="starShow l sleep_star2">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
											<li class="cf">
												<span class="l">入睡速度：</span>
												<div class="starShow l sleep_star3">
													<b></b>
													<b></b>
													<b></b>
													<b></b>
													<b></b>
												</div>
											</li>
										</ul>
									</div>
									<p class="layui-clear"></p>
								</div>
							</div>
						</div>
						<div class="layui-col-xs6 layui-col-md6">
							<div class="layui-card pirit_z">
								<div class="layui-card-header">
									风险提示
								</div>
								<div class="layui-card-body">
									<div>
										<ol class="olState_sm">
											<li></li>
										</ol>
									</div>
								</div>
							</div>
						</div>
					</div><br />

					<div class="layui-row layui-col-space20">
						<div class="layui-col-xs3 layui-col-md3">
							<div class="layui-card">
								<div class="layui-card-header">
									深睡
								</div>
								<div class="layui-card-body xlf" id="smss">
								</div>
							</div>
							<div class="layui-card">
								<div class="layui-card-header">
									浅睡
								</div>
								<div class="layui-card-body xlf" id="smqs">
								</div>
							</div>
							<div class="layui-card">
								<div class="layui-card-header">
									异常
								</div>
								<div class="layui-card-body xlf" id="smyc">
								</div>
							</div>
						</div>
						<div class="layui-col-xs9 layui-col-md9">
							<div class="layui-card">
								<div class="layui-card-header">
									睡眠状态分析
								</div>
								<div class="layui-card-body">
									<div class="sleep_wrap">
										<div id="sleep3" class="user_echarts"></div>
										<div id="sleep0" class="user_echarts"></div>
									</div>
								</div>
							</div>
						</div>
					</div><br />

					<div class="layui-card">
						<div class="layui-card-header">
							睡眠趋势分析
						</div>
						<div class="layui-card-body">
							<div id="sleep1" class="user_echarts">
							</div>
						</div>
					</div>

				</div>
				<div class="layui-tab-item zby_it">
					<div class="layui-row">
						<div class="layui-col-xs4 layui-col-md4">
							<table class="layui-table">
								<colgroup>
									<col width="150">
									<col width="150">
									<col width="200">
									<col>
								</colgroup>
								<tbody>
									<tr>
										<td class="zbytablecolor">手机:</td>
										<td id="usersj"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">松果ID:</td>
										<td id="usersgid"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">性别：</td>
										<td id="usersex"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">年龄：</td>
										<td id="userage"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">身高：</td>
										<td id="usersg"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">体重：</td>
										<td id="usertz"></td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="layui-col-xs4 layui-col-md4">
							<table class="layui-table">
								<colgroup>
									<col width="150">
									<col width="150">
									<col width="200">
									<col>
								</colgroup>
								<tbody>
									<tr>
										<td class="zbytablecolor">位置:</td>
										<td id="userwz"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">疾病史：</td>
										<td id="userjbs"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">家族病史：</td>
										<td id="userjzbs"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">手术史：</td>
										<td id="usersss"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">过敏情况：</td>
										<td id="usergmqk"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">慢性病：</td>
										<td id="usermxb"></td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="layui-col-xs4 layui-col-md4">
							<table class="layui-table">
								<colgroup>
									<col width="150">
									<col width="150">
									<col width="200">
									<col>
								</colgroup>
								<tbody>
									<tr>
										<td class="zbytablecolor">胃口状态：</td>
										<td id="userwkzt"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">饮食习惯：</td>
										<td id="userysxg"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">吸烟状态：</td>
										<td id="userxyzt"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">烟龄：</td>
										<td id="useryl"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">情绪状态：</td>
										<td id="userqxzt"></td>
									</tr>
									<tr>
										<td class="zbytablecolor">亲友聚会：</td>
										<td id="userqyjh"></td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<div>
						<button class="layui-btn zbyNewBl" onclick="showBingli(ash)">新建档案</button>
					</div>
					<br />
					<div>
						<div class="layui-card zbyblcard">
							<div class="layui-card-body">
								<div class="layui-form-item">
									<input name="title" id="userbltit" class="layui-input" type="text" placeholder="请输入档案标题（长度20字以内）" autocomplete="off" lay-verify="title">
								</div>
								<textarea id="editor" placeholder="Balabala" style="width:100%;height:400px;" autofocus></textarea>
								<div class="zbybtnz">
									<button class="layui-btn" onclick="clearNewBl()">取消</button>
									<button class="layui-btn" onclick="okBl(okstart,ss)">完成</button>
									<i class="layui-clear"></i>
								</div>
							</div>
						</div>
					</div><br />
					<!--病例-->
					<div id="showBl">
						<!--<div class="layui-card">
					<div class="layui-card-header">
						<span>文章标题</span><span class="zbyspan">上传时间：<span>2018-08-28 17:27:25</span></span><span class="zbyspan">发布人：<span>lz</span></span><button class="layui-btn zbywz">编辑</button><button class="layui-btn zbywz">删除</button><i class="layui-clear"></i>
					</div>
					<div class="layui-card-body">
						<div id="testShow" style="width: 100%;">

						</div>
					</div>
				</div>-->
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript" src="../../assets/libs/jquery-3.2.1.min.js"></script>
		<script type="text/javascript" src="../../assets/libs/layui/layui.js"></script>
		<script type="text/javascript" src="../../module/common.js"></script>
		<script type="text/javascript" src="../../assets/libs/echarts.js"></script>
		<script type="text/javascript" src="../../assets/libs/swiper.min.js"></script>
		<script type="text/javascript" src="../../assets/libs/module.js"></script>
		<script type="text/javascript" src="../../assets/libs/hotkeys.js"></script>
		<script type="text/javascript" src="../../assets/libs/uploader.js"></script>
		<script type="text/javascript" src="../../assets/libs/simditor.js"></script>
		<script type="text/html" id="zfldlb">
			<a class="layui-btn  layui-btn-sm" lay-event="kw">查看</a>
		</script>

		<script>
			layui.config({
				base: '../../module/'
			}).extend({
				formSelects: 'formSelects/formSelects-v4',
				treetable: 'treetable-lay/treetable'
			}).use(['config', 'index', 'element'], function() {
				var config = layui.config;
				var index = layui.index;
				var element = layui.element;
				// 检查多标签功能是否开启
				index.checkPageTabs();

				var igu = localStorage.getItem("gao");

				$('.zby_it').css("height", igu - 120 + "px")

			});

			var curTime = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate();
			var url = 'http://api.sungohealth.com/healthy/year';
			var dateArr = [];
			var myArr = new Array();

			var d = {}

			var ash = {
				"s": "add"
			}

			var dayTime = '0';
			var userinfo = {}

			var okstart = "add"

			var ss;

			var sle = ''

			dayTime = curTime;
			var listd = '';
			var editor;
			Simditor.locale = 'zh-CN'; //设置中文
			editor = new Simditor({
				textarea: $('#editor'), //textarea的id
				placeholder: '这里输入文字...',
				toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'fontScale', 'color', '|', 'ol', 'ul', 'blockquote', 'code', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent', 'alignment'], //工具条都包含哪些内容
				pasteImage: true, //允许粘贴图片
				defaultImage: 'assets/images/image.png', //编辑器插入的默认图片，此处可以删除
				upload: {
					url: 'richtext_img_upload.do', //文件上传的接口地址
					params: null, //键值对,指定文件上传接口的额外参数,上传的时候随文件一起提交
					fileKey: 'upload_file', //服务器端获取文件数据的参数名
					connectionCount: 3,
					leaveConfirm: '正在上传文件'
				}
			});

			var hqid = parent.$(".layui-tab-title .layui-this").attr("lay-id");

			console.log(hqid)

			function showBingli(sss) {
				if(sss.s == 'add') {
					okstart = "add";
					$("#userbltit").val("");
					editor.setValue("");
					shouBl();
				} else if(sss.s == 'update') {
					var g = userssid('luid');
					var l = sss.aa
					if(g != l) {
						showicon(2, "您不是此条档案的发布者，无法进行编辑操作！")
					} else {
						okstart = "up"
						$("#userbltit").val(sss.aa);
						editor.setValue(sss.ac)
						sle = sss.at
						shouBl();
					}
				}
			}

			function okBl(a, b) {
				if(a == "add") {
					addBingli()
				} else if(a == "up") {
					updateBingli(b)
				}
			}

			getBingliList();

			function shouBl() {

				$('.zbyblcard').css("display", "block")
				$('.zbyNewBl').css("display", "none")
			}

			function clearNewBl() {
				$('.zbyblcard').css("display", "none")
				$('.zbyNewBl').css("display", "block")
			}

			function getBingliList() {
				layui.use(['admin', 'config'], function() {
					var admin = layui.admin;
					var config = layui.config;
					var userinfo = admin.getTempData(hqid);
					var alog = config.getTempData('loginInfo')

					var oi = ""
					if(alog.orgId == 1) {
						oi = " "
					} else if(alog.orgId == 3) {
						oi = " "
					} else {
						oi = alog.orgId
					}

					$.ajax({
						type: "POST",
						url: userListBingli,
						data: {
							params: JSON.stringify({
								sortOrder: "asc",
								pageSize: 10,
								pageNumber: 1,
								orgId: oi,
								userId: userinfo.userId + ""
							})
						},
						dataType: "json",
						xhrFields: {
							withCredentials: true
						},
						beforeSend: function(request) {},
						success: function(data) {
							var show = '';
							var update = "update"
							for(var i = 0; i < data.rows.length; i++) {

								ss = {
									"s": "update",
									"ai": data.rows[i].title,
									"ac": data.rows[i].content,
									"at": data.rows[i].archivesId,
									"aa": data.rows[i].creatorId
								}
								ss = JSON.stringify(ss);

								show += '<div class="layui-card">'
								show += '<div class="layui-card-header">'
								show += "<span>" + data.rows[i].title + "</span>"
								show += "<span  class='zbyspan'>发布人：<span>" + data.rows[i].creatorName + "</span></span>"
								show += "<span class='zbyspan'>更新时间：<span>" + data.rows[i].addTiem + "</span></span>"
								show += "<button class='layui-btn zbywz layui-btn-danger' onclick='delBingli(" + ss + ")'>删除</button>"
								show += "<button class='layui-btn zbywz' onclick='showBingli(" + ss + ") '>编辑</button><i class='layui-clear'></i></div>"
								show += '<div class="layui-card-body">'
								show += '	<div id="testShow" style="width: 100%;">'
								show += data.rows[i].content
								show += '	</div></div></div>'
							}
							document.getElementById("showBl").innerHTML = show;
						},
						error: function(result) {
							console.log(result);
						},
					});
				})
			}

			function addBingli() {
				layui.use(['admin', 'config'], function() {
					var admin = layui.admin;
					var config = layui.config;
					var userinfo = admin.getTempData(hqid);
					var alog = config.getTempData('loginInfo')

					var content = editor.getValue();
					var title = $("#userbltit").val();
					if(title.length == 0) {
						showicon(2, "请输入档案标题！")
						return;
					} else if(title.length >= 20) {
						showicon(2, "请输入正确长度的档案标题！")
						return;
					}
					if(content.length == 0) {
						showicon(2, "请输入档案内容！")
						return;
					}

					$.ajax({
						type: "POST",
						url: userAddBingli,
						data: {
							params: JSON.stringify({
								userId: userinfo.userId,
								creatorId: alog.userId,
								orgId: alog.orgId,
								title: title,
								content: content
							})
						},
						dataType: "json",
						xhrFields: {
							withCredentials: true
						},
						beforeSend: function(request) {},
						success: function(data) {
							if(data.code == 0) {
								showicon(1, data.msg)
							} else {
								showicon(2, data.msg)
							}
							clearNewBl();
							$("#showBl").empty();
							getBingliList();
						},
						error: function(result) {
							console.log(result);
						},
					});
				})
			}

			function showicon(num, hhh) {
				layui.use(['layer', 'config'], function() {
					var layer = layui.layer;
					layer.msg(hhh, {
						icon: num
					});
				})
			}

			function userssid(uv) {
				var id;
				layui.use(['admin', 'config'], function() {
					var admin = layui.admin;
					var config = layui.config;
					var userinfo = admin.getTempData(hqid);
					var alog = config.getTempData('loginInfo')

					if(uv == 'usid') {
						id = userinfo.userId
					} else if(uv == 'luid') {
						id = alog.userId
					} else if(uv == 'orgid') {
						id = alog.orgId
					} else if(uv == 'username') {
						id = alog.username
					}
				})
				console.log(id)
				return id;
			}

			function updateBingli(a) {

				a = JSON.parse(a)

				var content = editor.getValue();
				var title = $("#userbltit").val();
				if(title.length == 0) {
					showicon(2, "请输入档案标题！")
					return;
				} else if(title.length >= 20) {
					showicon(2, "请输入正确长度的档案标题！")
					return;
				}
				if(content.length == 0) {
					showicon(2, "请输入档案内容！")
					return;
				}
				$.ajax({
					type: "POST",
					url: userUpdateBingli,
					data: {
						params: JSON.stringify({
							archivesId: sle,
							title: title,
							content: content
						})
					},
					dataType: "json",
					xhrFields: {
						withCredentials: true
					},
					beforeSend: function(request) {},
					success: function(data) {
						if(data.code == 0) {
							showicon(1, data.msg)
						} else {
							showicon(2, data.msg)
						}
						$("#showBl").empty();
						clearNewBl();
						getBingliList();
					},
					error: function(result) {
						console.log(result);
					},
				});
			}

			function showData(times, uid) {
				layui.use(['laydate', 'admin', 'table'], function() {
					$.ajax({
						type: 'POST',
						url: url,
						async: false,
						data: {
							userId: uid,
							token: token,
							addTime: curTime,
							friendId: uid,
							interfaceType: 'health'
						},
						dataType: 'json',
						success: function(response) {
							dateArr = new Array();
							var vDay = "{"
							for(i = 0; i <= 11; i++) {
								if(response.data[i]['days'].length !== 0) {
									dateArr.push(response.data[i]);
								}
							}
							for(var a = 0; a < dateArr.length; a++) {
								for(var b = 0; b < dateArr[a]['days'].length; b++) {

									if(dateArr[dateArr.length - 1]['days'][dateArr[a]['days'].length - 1] == dateArr[a]['days'][b]) {
										vDay += '"' + dateArr[a]['days'][b] + '":""';
										listd = dateArr[a]['days'][b];
									} else {
										vDay += '"' + dateArr[a]['days'][b] + '":"",';
									}
								}
							}
							vDay += "}"

							d = JSON.parse(vDay)

							var laydate = layui.laydate;
							var admin = layui.admin;
							var userinfo = admin.getTempData(hqid);
							var table = layui.table;

							showInfo(times, userinfo.userId, userinfo.userId, token);

							var a = '#test18'
							laydate.render({
								elem: a,
								value: times,
								mark: d,
								done: function(value, date) {
									dayTime = value;
									showInfo(value, userinfo.userId, userinfo.userId, token);
								}
							});

						},
						complete: function() {

						},
						error: function(result) {
							console.log(result);
							config.removeToken();
							location.replace('login.html');
						}
					})
				})
			}

			function nextDate() {
				dayTime = addDate(dayTime, 1)
				showData(dayTime, userinfo.userId)
			}

			function delBingli(a) {
				layui.use(['layer', 'config'], function() {
					var layer = layui.layer;
					var g = userssid('luid');
					var l = a.aa
					if(g != l) {
						showicon(2, "您不是此条档案的发布者，无法进行删除操作！")
					} else {
						layer.confirm('确定将此档案删除吗？', function(i) {
							layer.close(i);
							$.ajax({
								type: "POST",
								url: userDelBingli,
								data: {
									archivesId: a.at
								},
								dataType: "json",
								xhrFields: {
									withCredentials: true
								},
								beforeSend: function(request) {},
								success: function(data) {
									if(data.code == 0) {
										showicon(1, data.msg)
									} else {
										showicon(2, data.msg)
									}
									$("#showBl").empty();
									getBingliList();
								},
								error: function(result) {
									console.log(result);
									//					config.removeToken();
									//					location.replace('login.html');
								},
							});
						});
					}
				})
			}

			function upDate() {
				dayTime = updateDate(dayTime, 1)
				showData(dayTime, userinfo.userId)
			}

			function listDay() {
				showData(listd, userinfo.userId)
			}

			function todayU() {
				showData(curTime, userinfo.userId)
			}

			function addDate(date, days) {
				var d = new Date(date);
				d.setDate(d.getDate() + days);
				var month = d.getMonth() + 1;
				var day = d.getDate();
				var val = d.getFullYear() + "-" + month + "-" + day;
				return val;
			}

			function updateDate(date, days) {
				var d = new Date(date);
				d.setDate(d.getDate() - days);
				var month = d.getMonth() + 1;
				var day = d.getDate();
				var val = d.getFullYear() + "-" + month + "-" + day;
				return val;
			}

			layui.use(['table', 'index', 'admin'], function() {
				var admin = layui.admin;
				var table = layui.table;
				userinfo = admin.getTempData(hqid);
				showData(curTime, userinfo.userId)

				if(userinfo.nickname != null) {
					if(userinfo.nickname.length == 1) {
						$(' #username').html(userinfo.nickname);
					} else if(userinfo.nickname.length == 2) {
						var a = userinfo.nickname;
						a = a.substring(0, 1)
						$(' #username').html(a + "*");
					} else {
						if(userinfo.nickname != null) {
							var a = userinfo.nickname;
							var x = a.substring(0, 1)
							var c = a.substring(userinfo.nickname.length - 1, userinfo.nickname.length)
							$(' #username').html(x + "***" + c);
						}
					}
				} else {
					$(' #username').html("未填写");
				}

				$(' #userdivec').html(userinfo.deviceName);
				$(' #userqd').html(userinfo.orgName);

				//手机号
				if(userinfo.username != null) {
					var z = userinfo.username;
					var t = z.substring(0, 3)
					var w = z.substring(userinfo.username.length - 4, userinfo.username.length)
					$(" #usersj").html(t + "****" + w)
				} else {
					$(' #usersj').html("未填写");
				}

				$(" #usersgid").html(userinfo.sungoId) //松果id
				$(" #usersg").html(userinfo.height) //身高
				$(" #usertz").html(userinfo.weight) //体重
				$(" #usersex").html(userinfo.sex) //性别
				$(" #userage").html(birthday(userinfo.birthday)) //年龄

				if(userinfo.city != null) {
					$(" #userwz").html(userinfo.city) //位置
				} else {
					$(" #userwz").html("未知") //位置
				}

				var uLabel = JSON.parse(userinfo.label)
				if(userinfo.label !== null) {
					$(" #userjbs").html(uLabel.disease) //疾病史
					$(" #userjzbs").html(uLabel.familialDisease) //家族病史
					$(" #usersss").html(uLabel.operation) //手术史
					$(" #usergmqk").html(uLabel.allergic) //过敏情况
					$(" #usermxb").html(uLabel.chronicDisease) //慢性病

					$(" #userwkzt").html(uLabel.appetite) //胃口状态
					$(" #userysxg").html(uLabel.dietaryHabit) //饮食习惯
					$(" #userxyzt").html(uLabel.smokingStatus) //吸烟状态
					$(" #useryl").html(uLabel.smokeForYear) //烟龄
					$(" #userqxzt").html(uLabel.emotionalState) //情绪状态
					$(" #userqyjh").html(uLabel.meetingNumber) //亲友聚会

				} else {
					$(" #userjbs").html('— —')
					$(" #userjzbs").html('— —')
					$(" #usersss").html('— —')
					$(" #usergmqk").html('— —')
					$(" #usermxb").html('— —')
					$(" #userwkzt").html('— —') //胃口状态
					$(" #userysxg").html('— —') //饮食习惯
					$(" #userxyzt").html('— —') //吸烟状态
					$(" #useryl").html('— —') //烟龄
					$(" #userqxzt").html('— —') //情绪状态
					$(" #userqyjh").html('— —') //亲友聚会
				}

				if(userinfo.headPortrait == null || userinfo.headPortrait == '') {
					$(' #usericon').attr('src', '../../assets/images/mrtx.png')
				} else {
					$(' #usericon').attr('src', userinfo.headPortrait)
				}
			})

			function birthday(strBirthday) {
				if(strBirthday != null) {
					var returnAge;
					var strBirthdayArr = strBirthday.split("-");
					var birthYear = strBirthdayArr[0];
					var birthMonth = strBirthdayArr[1];
					var birthDay = strBirthdayArr[2];

					d = new Date();
					var nowYear = d.getFullYear();
					var nowMonth = d.getMonth() + 1;
					var nowDay = d.getDate();

					if(nowYear == birthYear) {
						returnAge = 0; //同年 则为0岁
					} else {
						var ageDiff = nowYear - birthYear; //年之差
						if(ageDiff > 0) {
							if(nowMonth == birthMonth) {
								var dayDiff = nowDay - birthDay; //日之差
								if(dayDiff < 0) {
									returnAge = ageDiff - 1;
								} else {
									returnAge = ageDiff;
								}
							} else {
								var monthDiff = nowMonth - birthMonth; //月之差
								if(monthDiff < 0) {
									returnAge = ageDiff - 1;
								} else {
									returnAge = ageDiff;
								}
							}
						} else {
							returnAge = -1; //返回-1 表示出生日期输入错误 晚于今天
						}
					}
					return returnAge; //返回周岁年龄			
				}

			}

			function showInfo(addTime, userId, friendId, token) {

				homeDate(addTime, userId, friendId, token);
				scoreDate(addTime, userId, friendId, token)
				organsDate(addTime, userId, friendId, token)
				spiritDate(addTime, userId, friendId, token)
				sportDate(addTime, userId, friendId, token)
				sleepDate(addTime, userId, friendId, token)

			}

			//接口
			function homeDate(addTime, userId, friendId, token) { //精神
				var url = comLink + "healthy/home";
				var data = {
					addTime: addTime,
					userId: userId,
					friendId: friendId,
					token: token
				};
				$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "json",
					success: function(data, status, xhr) {
						if(data.status == '0' || data.msg == '成功') {
							showHealtv(null, null, null, null)
							$(" #jkva").html("")
							$(" #jkva").html(data.data.scoreAll)
							showHealtv(data.data.scoreSprite, data.data.scoreViscera, data.data.scoreSport, data.data.scoreSleep);
							$(' #ztfxva').html(data.data.meStatus);
							if(data.data.hints != null) {
								$(' #fxtsva').html(userHomeTip(data.data.hints));
							}

							var z = document.getElementById('ztfxva');
							var y = document.getElementById('fxtsva');
							//				$('.zby_ifream').css("height", oDiv.offsetHeight - 33 + "px")
							if(z.offsetHeight > y.offsetHeight) {
								$('.zbyy').css("height", z.offsetHeight - 20 + "px")
							} else {
								$('.zbyz').css("height", y.offsetHeight - 20 + "px")
							}
						}
					},
					error: function(result) {}
				});
			}

			//状态提示
			function userHomeTip(hometip) {
				var tip = ""
				for(var i = 0; i < hometip.length; i++) {
					tip += hometip[i].title + " : " + hometip[i].content + "<br/>"
				}
				return tip;
			}
			//分值提示
			function showHealtv(scoreSprite, scoreViscera, scoreSport, scoreSleep) {
				if(scoreSprite != null) {
					$(' #jsva').html("-" + showCha(25, scoreSprite))
					pro('jsp', percentNum(scoreSprite, 25))
				} else {
					$(' #jsva').html(0)
					pro('jsp', "0%")
				}
				if(scoreViscera != null) {
					$(' #zfva').html("-" + showCha(50, scoreViscera))
					pro('zfp', percentNum(scoreViscera, 50))
				} else {
					$(' #zfva').html(0)
					pro('zfp', "0%")
				}
				if(scoreSport != null) {
					$(' #ydva').html("-" + showCha(10, scoreSport))
					pro('ydp', percentNum(scoreSport, 10))
				} else {
					$(' #ydva').html(0)
					pro('ydp', "0%")
				}
				if(scoreSleep != null) {
					$(' #smva').html("-" + showCha(15, scoreSleep))
					pro('smp', percentNum(scoreSleep, 15))
				} else {
					$(' #smva').html(0)
					pro('smp', "0%")
				}
			}

			function showCha(bz, hd) {
				if(hd != null) {
					return bz - hd;
				}
			}

			function percentNum(num, num2) {
				return(Math.round(num / num2 * 10000) / 100.00 + "%"); //小数点后两位百分比
			}

			function pro(pid, bfb) {
				layui.use('element', function() {
					var element = layui.element;
					element.progress(pid, bfb)
				});
			}
			//接口
			function scoreDate(addTime, userId, friendId, token) { //健康
				var url = comLink + "healthy/HealthScores";
				var data = {
					addTime: addTime,
					userId: userId,
					friendId: friendId,
					token: token,
				};
				$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "json",
					success: function(data, status, xhr) {
						if(data.status == '0' || data.msg == '成功') {

							fn_option_score(addTime, data); //数据渲染
						} else {

						}
					},
					error: function(result) {}
				});
			}

			function fn_option_score(time, data) { //数据渲染

				//数据处理
				var last16 = dayList(time).last16; //日期
				var dataTemp = dayList(time).ecShow; //echart日期
				var uesTemp = dayList(time).ecUse; //echart日期下标

				var data_arr = data.data;
				var option2_date = [];

				$.each(last16, function(key, val) { //日期数据比对，生成echart需要数据
					$.each(data_arr, function(k, v) {
						if(val == v.home_date) {
							option2_date[key] = v.score_all;
						}
					});
				});
				//健康

				var info_score = {
					grid: {
						y: 20,
						x2: 14,
						y2: 30,
						x: 40
					}, //边距
					tooltip: { //提示框
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 65, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemp[0] + '月' + timeTemp[1] + '日';
							var res = '<div class="tooltip"><p>' + timeShow + '</p>';
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(params[i].data) {
										res += '<p>分值：' + params[i].data + '</p>'
									} else {
										res += '<p>分值：---</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					xAxis: { //x轴
						type: 'category',
						boundaryGap: false,
						data: uesTemp, //日期下标数据
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: { //y轴
						scale: true,
						max: 100,
						min: 0,
						splitNumber: 5,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					series: [{
						type: 'line',
						smooth: true,
						data: option2_date, //健康数据
						itemStyle: {
							normal: {
								color: '#86d9e0',
								lineStyle: {
									color: '#86d9e0'
								}
							}
						},
					}],
				};

				echarts.init(document.getElementById("user_score")).setOption(info_score, true);
			}

			function organsDate(addTime, userId, friendId, token) { //脏腑
				var url = comLink + "viscera/data";
				var data = {
					addTime: addTime,
					userId: userId,
					friendId: friendId,
					token: token
				};
				$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "json",
					success: function(data, status, xhr) {
						if(data.status == '0' || data.msg == '成功') {
							fn_option_zf(addTime, data.data); //数据渲染
						} else {
							layui.use('table', function() {
								var table = layui.table;
								//展示已知数据
								table.render({
									elem: '#zfld',
									height: 300,
									cols: [
										[ //标题栏
											{
												field: 'addTime',
												title: '测试时间',
												templet: function(b) {
													return b.addTime.split(' ')[1];
												}
											}, {
												field: 'heartRate',
												title: '呼吸率',
												templet: function(b) {
													return b.heartRate + "次/分";
												}
											}, {
												field: 'restingRate',
												title: '静息心率',
												templet: function(b) {
													return b.restingRate + "次/分";
												}
											}, {
												field: 'cardiacFunc',
												title: '心脏功能',
											}, {
												field: 'cz',
												title: '操作',
												toolbar: "#zfldlb"
											}

										]
									],
									data: [],
								});
							});

							layui.use('table', function() {
								var table = layui.table;
								//展示已知数据
								table.render({
									elem: '#xyl',
									height: 260,
									cols: [
										[ //标题栏
											{
												field: 'addTime',
												title: '测试时间',
												templet: function(b) {
													if(b.visceraTime != null) {
														return b.visceraTime.split(' ')[1];
													} else {
														return '';
													}

												}
											}, {
												field: 'systolicPressure',
												title: '收缩压',
											}, {
												field: 'diastolicPressure',
												title: '舒张压',
											}
										]
									],
									data: [],
								});
							});
						}
					},
					error: function(result) {},
					//		complete: function() {
					//			tians();
					//		}
				});
			}

			function fn_option_zf(time, data) {
				//
				//

				//页面展示信息
				//评星
				/*
				5星~100分
				4.5星~ >=90分
				4星~ >=80分
				3.5星~ >=70分
				3星~ >=60分
				*/

				/*
   目前得分会有60分以下的。
   5星=100分，4.5星>=90分，
   4星>=80分，3.5星>=70分，
   3星>=60分，2.5星>=50分，
   2星>=40分，1.5星>=30分，
   else1星
    */

				function star_number(star) { //数值分类
					if(!star) {
						return 0;
					} else {
						if(star == 100) {
							return 5;
						} else if(star >= 90) {
							return 4.5;
						} else if(star >= 80) {
							return 4;
						} else if(star >= 70) {
							return 3.5;
						} else if(star >= 60) {
							return 3;
						} else if(star >= 50) {
							return 2.5;
						} else if(star >= 40) {
							return 2;
						} else if(star >= 30) {
							return 1.5;
						} else if(star > 0) {
							return 1;
						} else if(star == 0) {
							return 0;
						}
					}
				}

				star_sun('.organs_star0', star_number(data.visceraFunc)); //脏腑功能
				star_sun('.organs_star1', star_number(data.visceraBalance)); //脏腑平衡

				$(".olState_zf li").html(data.visceraCode); //运动状态提示

				var colorList = [
					'#1baeba',
					'#1cb8c5',
					'#1cc3d1',
					'#1edbea',
					'#1fe6f6',
					'#20edfe',
					'#2decfb',
					'#39ebf9',
					'#45ebf8',
					'#52ecf8',
					'#5eedf8',
					'#6ceef8',
					'#79eff8',
					'#87f0f8',
					'#95f0f7',
					'#a4f1f7',
					'#b3f4f9',
					'#c5f7fb',
					'#d4f7fa',
					'#dff6f8',
					'#ebf7f8',
					'#f5f8f8',
					'#fafcfc',
				];

				//数据处理
				var last16 = dayList(time).last16; //日期
				var dataTemp = dayList(time).ecShow; //echart日期
				var uesTemp = dayList(time).ecUse; //echart日期下标

				//运动-数据
				var organs1_data1 = [],
					organs1_data2 = [],
					organs1_data3 = [],
					organs1_data4 = [],
					organs1_data5 = [],
					organs1_data6 = [],
					organs1_data7 = [],
					organs1_data8 = [];
				var data_arr1 = data.averageVisceras;

				if(data_arr1) { //不为空
					$.each(last16, function(key, val) { //日期数据比对，生成echart需要数据
						$.each(data_arr1, function(k, v) { //昼夜节律趋势分析
							if(val == v.dataDate) {
								organs1_data1[key] = v.intHeart; //心
								organs1_data2[key] = v.intLiver; //肝
								organs1_data3[key] = v.intKidney; //肾
								organs1_data4[key] = v.intSpleen; //脾
								organs1_data5[key] = v.intLungs; //肺
								organs1_data6[key] = v.systolicPressure; //收缩压
								organs1_data7[key] = v.diastolicPressure; //舒张压
								organs1_data8[key] = v.systolicPressure - v.diastolicPressure;
							}
						});
					});

					if(organs1_data1.length < 16) {
						organs1_data1[15] = '';
					} //数组不足16个时
					if(organs1_data2.length < 16) {
						organs1_data2[15] = '';
					}
					if(organs1_data3.length < 16) {
						organs1_data3[15] = '';
					}
					if(organs1_data4.length < 16) {
						organs1_data4[15] = '';
					}
					if(organs1_data5.length < 16) {
						organs1_data5[15] = '';
					}
					if(organs1_data6.length < 16) {
						organs1_data6[15] = '';
					}
					if(organs1_data7.length < 16) {
						organs1_data7[15] = '';
					}
					if(organs1_data8.length < 16) {
						organs1_data8[15] = '';
					}
				}

				var organs0_data1 = [];
				var menu = '';
				var data_arr0 = []
				data_arr0 = data.visceraArrayList;

				if(data_arr0) { //不为空
					$.each(data_arr0, function(key, val) { //脏腑平衡状态
						var obj = {};
						obj.value = [];
						obj.itemStyle = {};

						//max值为均等的时候，不需要对数据做处理
						obj.value[0] = val.intHeart; //心
						obj.value[1] = val.intLiver; //肝
						obj.value[2] = val.intKidney; //肾
						obj.value[3] = val.intSpleen; //脾
						obj.value[4] = val.intLungs; //肺

						obj.itemStyle.color = colorList[key];
						organs0_data1[key] = obj;
						//雷达图，每次的循环
						if(val.visceraTime != null) {
							menu += '<div class="swiper-slide"><h2 class="organs_h1">' + val.visceraTime.split(' ')[1] + '</h2><div class="organs_sub" id="organs_sub' + key + '"></div></div>'

						} else {
							menu += '<div class="swiper-slide"><h2 class="organs_h1">' + '</h2><div class="organs_sub" id="organs_sub' + key + '"></div></div>'
						}

					});

					layui.use('table', function() {
						var table = layui.table;
						//展示已知数据
						table.render({
							elem: '#zfld',
							height: 300,
							cols: [
								[ //标题栏
									{
										field: 'addTime',
										title: '测试时间',
										event: 'cssj',
										templet: function(b) {
											return b.addTime.split(' ')[1];
										}
									}, {
										field: 'heartRate',
										title: '呼吸率',
										event: 'hxl',
										templet: function(b) {
											return b.heartRate + "次/分";
										}
									}, {
										field: 'restingRate',
										title: '静息心率',
										event: 'jxxl',
										templet: function(b) {
											return b.restingRate + "次/分";
										}
									}, {
										field: 'cardiacFunc',
										event: 'xzgn',
										title: '心脏功能',
									}
								]
							],
							data: data_arr0,
						});
					});

					layui.use('table', function() {
						var table = layui.table;
						//展示已知数据
						table.render({
							elem: '#xyl',
							height: 260,
							cols: [
								[ //标题栏
									{
										field: 'addTime',
										title: '测试时间',
										templet: function(b) {
											if(b.visceraTime != null) {
												return b.visceraTime.split(' ')[1];
											} else {
												return '';
											}

										}
									}, {
										field: 'systolicPressure',
										title: '收缩压',
									}, {
										field: 'diastolicPressure',
										title: '舒张压',
									}
								]
							],
							data: data_arr0,
						});
					});

				} else {
					layui.use('table', function() {
						var table = layui.table;
						//展示已知数据
						table.render({
							elem: '#zfld',
							height: 300,
							cols: [
								[ //标题栏
									{
										field: 'addTime',
										title: '测试时间',
										event: 'cssj',
										templet: function(b) {
											return b.addTime.split(' ')[1];
										}
									}, {
										field: 'heartRate',
										title: '呼吸率',
										event: 'hxl',
										templet: function(b) {
											return b.heartRate + "次/分";
										}
									}, {
										field: 'restingRate',
										title: '静息心率',
										event: 'jxxl',
										templet: function(b) {
											return b.restingRate + "次/分";
										}
									}, {
										field: 'cardiacFunc',
										title: '心脏功能',
										event: 'xzgn',
									}
								]
							],
							data: [],
						});
					});

					layui.use('table', function() {
						var table = layui.table;
						//展示已知数据
						table.render({
							elem: '#xyl',
							height: 260,
							cols: [
								[ //标题栏
									{
										field: 'addTime',
										title: '测试时间',
										templet: function(b) {
											if(b.visceraTime != null) {
												return b.visceraTime.split(' ')[1];
											} else {
												return '';
											}

										}
									}, {
										field: 'systolicPressure',
										title: '收缩压',
									}, {
										field: 'diastolicPressure',
										title: '舒张压',
									}
								]
							],
							data: [],
						});
					});

				}

				layui.use(['table', 'index', 'admin'], function() {
					var table = layui.table;
					table.on('tool(demos)', function(obj) {
						var data = obj.data;
						if(obj.event === 'cssj' || obj.event === 'hxl' || obj.event === 'jxxl' || obj.event === 'xzgn') {
							var lIndex = 0;
							for(var i = 0; i < data_arr0.length; i++) {
								if(data.addTime == data_arr0[i].addTime) {
									lIndex = i;
								}
							}
							mySwiper.slideTo(lIndex, 1000, false);
						}
					});
				});

				$(".hh").html(menu);
				var kk = 0;
				var mySwiper = new Swiper('.xue', { //渲染执行
					pagination: '.pagination',
					loop: false,
					grabCursor: true,
					paginationClickable: true
				});
				var txt = 0;

				$('.arrow-left').on('click', function(e) {
					e.preventDefault();
					mySwiper.slidePrev();
				});
				$('.arrow-right').on('click', function(e) {
					e.preventDefault();
					mySwiper.slideNext();
				});

				// 脏腑0
				var option4 = {
					grid: {
						y: 10,
						x2: 15,
						y2: 10,
						x: 14
					},
					tooltip: {
						show: false,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
					},
					radar: {
						name: {
							textStyle: {
								fontSize: 14,
								color: '#333',
							}
						},
						splitNumber: 3,
						indicator: [

							{
								text: '心脏',
								max: 200
							},
							{
								text: '肝脏',
								max: 200
							},
							{
								text: '肾脏',
								max: 200
							},
							{
								text: '脾脏',
								max: 200
							},
							{
								text: '肺脏',
								max: 200
							},
						]
					},
					series: [{
						type: 'radar',
						data: organs0_data1
					}]
				};

				optionzfqs = {
					grid: {
						y: 50,
						x2: 0,
						y2: 30,
						x: 0,
					},
					tooltip: { // 提示框
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 75, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemp[0] + '月' + timeTemp[1] + '日';
							var res = '<div class="tooltip"><p>' + timeShow + '</p>';
							for(var i = 0; i < params.length; i++) {
								if(params[i].seriesName == "心脏") {
									if(params[i].data) {
										res += '<p class="p_ico1">心脏：' + params[i].data + '</p>'
									} else {
										res += '<p class="p_ico1">心脏：---</p>'
									}
								} else if(params[i].seriesName == "肝脏") {
									if(params[i].data) {
										res += '<p class="p_ico2">肝脏：' + params[i].data + '</p>'
									} else {
										res += '<p class="p_ico2">肝脏：---</p>'
									}
								} else if(params[i].seriesName == "肾脏") {
									if(params[i].data) {
										res += '<p class="p_ico3">肾脏：' + params[i].data + '</p>'
									} else {
										res += '<p class="p_ico3">肾脏：---</p>'
									}
								} else if(params[i].seriesName == "脾脏") {
									if(params[i].data) {
										res += '<p class="p_ico4">脾脏：' + params[i].data + '</p>'
									} else {
										res += '<p class="p_ico4">脾脏：---</p>'
									}
								} else if(params[i].seriesName == "肺脏") {
									if(params[i].data) {
										res += '<p class="p_ico5">肺脏：' + params[i].data + '</p>'
									} else {
										res += '<p class="p_ico5">肺脏：---</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					xAxis: {
						type: 'category',
						boundaryGap: true,
						data: uesTemp,
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						// scale: true,
						max: 200,
						min: 0,
						interval: 70, //强制刻度间隔
						// splitNumber: 5,//自动刻度间隔
						type: 'value',
						axisLabel: {
							show: false,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: true,
							areaStyle: {
								color: ['#fff', '#f6f6f6', '#fff']
							}
						}
					},
					color: ['#d73835', '#66bb6a', '#b28850', '#fad53e', '#78909c'],
					legend: { //图例
						x: 'center',
						itemWidth: 15,
						itemHeight: 6,
						itemGap: 20,
						data: [{
								name: '心脏',
								icon: 'rect',
							}, {
								name: '肝脏',
								icon: 'rect'
							},
							{
								name: '肾脏',
								icon: 'rect'
							}, {
								name: '脾脏',
								icon: 'rect'
							},
							{
								name: '肺脏',
								icon: 'rect'
							}
						],
					},
					series: [{
						name: '心脏',
						type: 'line',
						smooth: true,
						data: organs1_data1,
						// symbol:'null', symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#d73835'
								}
							}
						},
					}, {
						name: '肝脏',
						type: 'line',
						smooth: true,
						data: organs1_data2,
						// symbol:'null', symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#66bb6a'
								}
							}
						},
					}, {
						name: '肾脏',
						type: 'line',
						smooth: true,
						data: organs1_data3,
						// symbol:'null', symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#b28850'
								}
							}
						},
					}, {
						name: '脾脏',
						type: 'line',
						smooth: true,
						data: organs1_data4,
						// symbol:'null', symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#fad53e'
								}
							}
						},
					}, {
						name: '肺脏',
						type: 'line',
						smooth: true,
						data: organs1_data5,
						// symbol:'null', symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#78909c'
								}
							}
						},
					}, ],
				};
				//血压
				var orgin_xy = {
					legend: {
						data: ['低压', '高压', '差值'],
						show: false
					},
					grid: {
						y: 10,
						x2: 30,
						y2: 20,
						x: 30,
					},
					xAxis: {
						type: 'category',
						data: uesTemp,
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						type: 'value',
						min: 40, // y轴可设置最小值，当然你也可以设置最大值max
						max: 160,
						interval: 20, // 刻度线的距离
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					tooltip: { // 提示框
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',

							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 100, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemps = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemps[0] + '月' + timeTemps[1] + '日';
							var res = '<div class="tooltip"><p>' + timeShow + '</p>';
							var shou = ''; //收缩压
							var shu = ''; //舒张压
							for(var i = 0; i < params.length; i++) {
								var stepTemp = Math.floor(params[0].data) + Math.floor(params[1].data);
								if(i == 0) {
									if(params[i].data) {
										shu += '<p>舒张压 ' + params[i].data + '</p>'
									} else {
										shu += '<p>舒张压 ---</p>'
									}
								} else if(i == 2) {
									if(params[i].data) {
										shou += '<p>收缩压 ' + params[i].data + '</p>'
									} else {
										shou += '<p>收缩压 ---</p>'
									}
								}
							}
							res += shou + shu;
							res += '</div>';
							return res;
						},
					},
					series: [{
							name: '低压',
							type: 'bar',
							stack: '血压',
							barWidth: 6,
							data: organs1_data7,
							itemStyle: {
								normal: {
									color: 'transparent' // 底部设置为透明，就可以不显示了
								}
							},
							markLine: { // 用markLine设置血压正常范围的表现
								symbol: ['none', 'none'],
								lineStyle: {
									normal: {
										color: 'green'
									}
								},
								data: [{
									yAxis: 80
								}, {
									yAxis: 130
								}],
							}
						}, {
							name: '差值',
							type: 'bar',
							stack: '血压',
							barWidth: 8,
							label: {
								normal: {
									show: false,
									position: 'top'
								}
							},
							itemStyle: {
								normal: {
									color: '#00A8B5' // 底部设置为透明，就可以不显示了
								}
							},
							data: organs1_data8 // 显示的这一部分柱状图，应该为血压最大值-最小值的差值
						},
						{
							name: '高压',
							type: 'bar',
							barWidth: 6,
							barGap: '-100%',
							itemStyle: {
								normal: {
									color: 'transparent' // 底部设置为透明，就可以不显示了
								}
							},
							data: organs1_data6 // 显示的这一部分柱状图，应该为血压最大值-最小值的差值
						}
					]
				};
				echarts.init(document.getElementById("user_organxy")).setOption(orgin_xy, true);
				echarts.init(document.getElementById("organs0")).setOption(option4, true);
				echarts.init(document.getElementById("user_organqs")).setOption(optionzfqs, true);

				var dayShow = 0;
				$('.cardiac_btn b').on("click", function() {
					if(dayShow == 1) {
						$(".nowShow").addClass('on');
						$(".dayShow").removeClass('on');
						dayShow = 0;
						$(".cardiac_btn h1").addClass('dn');
						$('.cardiac_now').css('z-index', '-10');
						$(".olState_zf li").html(data.visceraCode); //运动状态提示
					} else if(dayShow == 0) {
						$(".dayShow").addClass('on');
						$(".nowShow").removeClass('on');
						dayShow = 1;
						$(".cardiac_btn h1").removeClass('dn');
						$('.cardiac_now').css('z-index', '10');
					}
				});

				//各雷达图-公共
				var option_com = {
					grid: {
						y: 10,
						x2: 14,
						y2: 10,
						x: 14
					},
					tooltip: {
						show: false
					},
					radar: {
						name: {
							textStyle: {
								fontSize: 14,
								color: '#333',
							}
						},
						splitNumber: 3,
						indicator: [{
								text: '心脏',
								max: 200
							},
							{
								text: '肝脏',
								max: 200
							},
							{
								text: '肾脏',
								max: 200
							},
							{
								text: '脾脏',
								max: 200
							},
							{
								text: '肺脏',
								max: 200
							},
						]
					},
					series: [{
						name: '',
						type: 'radar',
						data: []
					}]
				};
				for(var i = 0; i < organs0_data1.length; i++) {
					option_com.series[0].data[0] = organs0_data1[i];
					echarts.init(document.getElementById('organs_sub' + i)).setOption(option_com, true)
				}
			}
			//精神

			//接口
			function spiritDate(addTime, userId, friendId, token) { //精神
				var url = comLink + "spirit/data";
				var data = {
					addTime: addTime,
					userId: userId,
					friendId: friendId,
					token: token
				};
				$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "json",
					success: function(data, status, xhr) {
						if(data.status == '0' || data.msg == '成功') {
							fn_option(addTime, data.data); //数据渲染
						}
					},
					error: function(result) {}
				});
			}

			function fn_option(time, data) {

				//页面展示信息
				//评星
				star_sun('.spirit_star0', data.ecgRhythm); //精神节律
				star_sun('.spirit_star1', data.tensionDegree); //身心负荷
				star_sun('.spirit_star2', data.ecgPressure); //精神压力
				star_sun('.spirit_star3', data.tiredIndex); //疲劳指数

				$(".olState li").html(data.psychosisCode); //精神状态提示

				//昼夜节律
				if(data.hr) {
					if(data.hr.hrSleep) {
						$(' #smjcxl').html(data.hr.hrSleep)
					} else {
						$(' #smjcxl').html("---");
					} //睡眠基准心率
					if(data.hr.hrDay) {
						$(' #rjpjxl').html(data.hr.hrDay)
					} else {
						$(' #rjpjxl').html("---");
					} //日间平均心率
					if(data.hr.hrNight) {
						$(' #zyxlc').html(data.hr.hrNight)
					} else {
						$(' #zyxlc').html("---");
					} //昼夜心率差
				} else {
					$(' #smjcxl').html("---");
					$(' #rjpjxl').html("---");
					$(' #zyxlc').html("---");
				}
				var useHourTemp = ['0:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '9:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '12:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '15:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '18:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '21:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '24:00'];

				if(data.hr) {
					var hr_data = JSON.parse(data.hr.hrData);
				}
				var ten_minute = [];
				for(var m = 0; m < 145; m++) {
					ten_minute[m] = m * 10;
				}
				var spirit1_data1 = []; //数值
				var spirit1_data1_text = []; //心率文字
				var spirit1_data1_txt = []; //描述
				if(hr_data) {
					$.each(hr_data, function(key, val) {
						$.each(val, function(k, v) {
							var minutesTemp = Math.floor(k.split(':')[0] * 60) + Math.floor(k.split(':')[1]);
							$.each(ten_minute, function(m, n) {
								if(Math.abs(minutesTemp - n) <= 5) { //小于等于5
									spirit1_data1[m] = v;
									spirit1_data1_text[m] = v;
									spirit1_data1_txt[m] = k;
								}
							})
						})
					});
					if(spirit1_data1.length < 145) {
						spirit1_data1[144] = '';
					} //数组不足145个时
					if(spirit1_data1_txt.length < 145) {
						spirit1_data1_txt[144] = '';
					}

					if(spirit1_data1_text.length < 145) {
						spirit1_data1_text[144] = '';
					}

				}
				if(spirit1_data1) { //补缺失2位以及以下的不足
					$.each(spirit1_data1, function(key, val) { //心率
						if(!val && spirit1_data1[key - 1] && spirit1_data1[key + 1]) { //缺一位
							spirit1_data1[key] = (parseInt(spirit1_data1[key - 1]) + parseInt(spirit1_data1[key + 1])) / 2
						} else if(!val && spirit1_data1[key - 1] && spirit1_data1[key + 2]) { //缺两位
							spirit1_data1[key] = (parseInt(spirit1_data1[key - 1]) + parseInt(spirit1_data1[key + 2])) / 2;
							spirit1_data1[key + 1] = (parseInt(spirit1_data1[key - 1]) + parseInt(spirit1_data1[key + 2])) / 2;
						}
					});
				}

				var start1, start2, end1, end2, s1Temp, s2Temp, e1Temp, e2Temp,
					pieces_txt = [{
							lte: 1,
							color: '#86d9e0'
						},
						{
							gt: 1,
							lte: 3,
							color: '#86d9e0'
						},
						{
							gt: 2,
							color: '#86d9e0'
						}
					];
				if(data.hr) {
					if(JSON.parse(data.hr.sleepHrTime).sleepStart1 && JSON.parse(data.hr.sleepHrTime).sleepStart2) {
						start1 = JSON.parse(data.hr.sleepHrTime).sleepStart1.split(':');
						start2 = JSON.parse(data.hr.sleepHrTime).sleepStart2.split(':');
						end1 = JSON.parse(data.hr.sleepHrTime).sleepEnd1.split(':');
						end2 = JSON.parse(data.hr.sleepHrTime).sleepEnd2.split(':');
						s1Temp = Math.round((Math.floor(start1[0] * 60) + Math.floor(start1[1])) / 10);
						s2Temp = Math.round((Math.floor(start2[0] * 60) + Math.floor(start2[1])) / 10);
						e1Temp = Math.round((Math.floor(end1[0] * 60) + Math.floor(end1[1])) / 10);
						e2Temp = Math.round((Math.floor(end2[0] * 60) + Math.floor(end2[1])) / 10);
						pieces_txt = [{
								lte: s1Temp,
								color: '#86d9e0'
							},
							{
								gt: s1Temp,
								lte: e1Temp,
								color: '#0091ea'
							},
							{
								gt: e1Temp,
								lte: s2Temp,
								color: '#86d9e0'
							},
							{
								gt: s2Temp,
								lte: e2Temp,
								color: '#0091ea'
							},
							{
								gt: e2Temp,
								color: '#86d9e0'
							}
						];

					} else if(JSON.parse(data.hr.sleepHrTime).sleepStart1) {
						start1 = JSON.parse(data.hr.sleepHrTime).sleepStart1.split(':');
						end1 = JSON.parse(data.hr.sleepHrTime).sleepEnd1.split(':');
						s1Temp = Math.round((Math.floor(start1[0] * 60) + Math.floor(start1[1])) / 10);
						e1Temp = Math.round((Math.floor(end1[0] * 60) + Math.floor(end1[1])) / 10);
						pieces_txt = [{
								lte: s1Temp,
								color: '#86d9e0'
							},
							{
								gt: s1Temp,
								lte: e1Temp,
								color: '#0091ea'
							},
							{
								gt: e1Temp,
								color: '#86d9e0'
							}
						];
					} else if(JSON.parse(data.hr.sleepHrTime).sleepStart2) {
						start2 = JSON.parse(data.hr.sleepHrTime).sleepStart2.split(':');
						end2 = JSON.parse(data.hr.sleepHrTime).sleepEnd2.split(':');
						s2Temp = Math.round((Math.floor(start2[0] * 60) + Math.floor(start2[1])) / 10);
						e2Temp = Math.round((Math.floor(end2[0] * 60) + Math.floor(end2[1])) / 10);
						pieces_txt = [{
								lte: s2Temp,
								color: '#86d9e0'
							},
							{
								gt: s2Temp,
								lte: e2Temp,
								color: '#0091ea'
							},
							{
								gt: e2Temp,
								color: '#86d9e0'
							}
						];
					}
				}

				//数据处理
				var last16 = dayList(time).last16; //日期
				var dataTemp = dayList(time).ecShow; //echart日期
				var uesTemp = dayList(time).ecUse; //echart日期下标

				//精神-数据
				var spirit_data1 = [],
					spirit_data2 = [],
					spirit_data3 = [],
					spirit2_data1 = [];
				var data_arr0 = data.averageEcgs;
				var data_arr1 = data.hrs;
				var data_arr2 = data.ecgDay;

				$.each(last16, function(key, val) { //日期数据比对，生成echart需要数据
					if(data_arr0) {
						$.each(data_arr0, function(k, v) {
							if(val == v.data_date) { //精神状态趋势分析
								spirit_data1[key] = v.day_tension_degree; //身心负荷
								spirit_data2[key] = v.day_hr_pressure; //精神压力
								spirit_data3[key] = v.day_tired_index; //疲劳指数
							}
						});
					}
					if(data_arr1) {
						$.each(data_arr1, function(k, v) { //昼夜节律趋势分析
							if(val == v.data_date) {
								spirit2_data1[key] = v.score;
							}
						});
					}

				});

				if(data_arr2) {
					layui.use('table', function() {
						var table = layui.table;
						//展示已知数据
						table.render({
							elem: '#jsl',
							height: 260,
							cols: [
								[ //标题栏
									{
										field: 'addTime',
										title: '测试时间',
										//								templet: function(b) {
										//									return b.visceraTime.split(' ')[1];
										//								}
									}, {
										field: 'eyTensionDegree',
										title: '身心负荷',
									}, {
										field: 'eyHrPressure',
										title: '精神压力',
									}, {
										field: 'eyTiredIndex',
										title: '疲劳指数',
									}
								]
							],
							data: data_arr2,
						});
					});
				} else {
					layui.use('table', function() {
						var table = layui.table;
						//展示已知数据
						table.render({
							elem: '#jsl',
							height: 260,
							cols: [
								[ //标题栏
									{
										field: 'addTime',
										title: '测试时间',
										//								templet: function(b) {
										//									return b.visceraTime.split(' ')[1];
										//								}
									}, {
										field: 'eyTensionDegree',
										title: '身心负荷',
									}, {
										field: 'eyHrPressure',
										title: '精神压力',
									}, {
										field: 'eyTiredIndex',
										title: '疲劳指数',
									}
								]
							],
							data: [],
						});
					});
				}

				if(spirit_data1.length < 16) {
					spirit_data1[15] = '';
				} //数组不足16个时
				if(spirit_data2.length < 16) {
					spirit_data2[15] = '';
				}
				if(spirit_data3.length < 16) {
					spirit_data3[15] = '';
				}
				if(spirit2_data1.length < 16) {
					spirit2_data1[15] = '';
				}

				// 精神0
				var option0 = {
					grid: {
						y: 50,
						x2: 14,
						y2: 30,
						x: 40
					},
					tooltip: {
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							}
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 110, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemp[0] + '月' + timeTemp[1] + '日';
							var res = '<div class="tooltip"><p>' + timeShow + '</p>';
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(params[i].data) {
										res += '<p class="p_fd"><b></b>身心负荷 ' + params[i].data + '</p>'
									} else {
										res += '<p class="p_fd"><b></b>身心负荷 ---</p>'
									}
								} else if(i == 1) {
									if(params[i].data) {
										res += '<p class="p_00">精神压力 ' + params[i].data + '</p>'
									} else {
										res += '<p class="p_00">精神压力 ---</p>'
									}
								} else if(i == 2) {
									if(params[i].data) {
										res += '<p class="p_86">疲劳程度 ' + params[i].data + '</p>'
									} else {
										res += '<p class="p_86">疲劳程度 ---</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					color: ['#fd7b52', '#0091ea', '#86d9e0'], //图例颜色
					legend: { //图例
						x: 'left',
						padding: [0, 0, 0, 35],
						itemWidth: 15,
						itemHeight: 6,
						itemGap: 27,
						data: [{
								name: '身心负荷',
								icon: 'rect',
							},
							{
								name: '精神压力',
								icon: 'rect'
							},
							{
								name: '疲劳指数',
								icon: 'rect'
							}
						],
					},
					xAxis: {
						type: 'category',
						boundaryGap: true,
						data: uesTemp, //日期下标数据
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						scale: true,
						max: 100,
						min: 0,
						splitNumber: 5,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					series: [{
						name: '身心负荷',
						type: 'line',
						smooth: true,
						data: spirit_data1, //精神数据1
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#fd7b52'
								}
							}
						},
					}, {
						name: '精神压力',
						type: 'line',
						smooth: true,
						data: spirit_data2, //精神数据2
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#0091ea'
								}
							}
						},
					}, {
						name: '疲劳指数',
						type: 'line',
						smooth: true,
						data: spirit_data3, //精神数据3
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#86d9e0'
								}
							}
						},
					}, ],
				};

				//精神1
				var option1 = {
					grid: {
						y: 20,
						x2: 14,
						y2: 30,
						x: 40,
					},
					tooltip: {
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 60, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = spirit1_data1_txt[params[0].dataIndex];
							var timeTemp_txt = spirit1_data1_text[params[0].dataIndex];
							if(!timeTemp) {
								timeTemp = '--:--:--'
							}
							var res = '<div class="tooltip"><p>' + timeTemp + '</p>'
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(timeTemp_txt) {
										res += '<p>' + timeTemp_txt + 'bpm</p>'
									} else {
										res += '<p>---bpm</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: useHourTemp, //时间下标数据
						axisLabel: {
							interval: 17,
							textStyle: {
								color: '#999',
								fontSize: '9'
							}
						}, //每隔17下标一次
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						scale: true,
						max: 160,
						min: 0,
						interval: 40,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					visualMap: { //时间分布
						show: false,
						dimension: 0,
						pieces: pieces_txt,
					},
					series: [{
						type: 'line',
						smooth: true,
						symbol: 'null',
						symbolSize: 0,
						data: spirit1_data1,
						itemStyle: {
							normal: {
								lineStyle: {
									width: 2
								}
							}
						},
					}], //精神数据4
				};

				//精神2
				var option2 = {
					grid: {
						y: 20,
						x2: 14,
						y2: 30,
						x: 40,
					},
					tooltip: {
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 60, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemp[0] + '月' + timeTemp[1] + '日';

							var res = '<div class="tooltip"><p>' + timeShow + '</p>';
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(params[i].data) {
										res += '<p>' + params[i].data + 'bpm</p>'
									} else {
										res += '<p>---bpm</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					xAxis: {
						type: 'category',
						boundaryGap: true,
						data: uesTemp, //日期下标数据
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						scale: true,
						max: 50,
						min: 0,
						splitNumber: 5,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					series: [{
						type: 'line',
						smooth: true,
						data: spirit2_data1, //精神数据5
						itemStyle: {
							normal: {
								color: '#86d9e0',
								lineStyle: {
									color: '#86d9e0'
								}
							}
						},
					}],
				};
				echarts.init(document.getElementById("user_spiritqs")).setOption(option0, true);
				echarts.init(document.getElementById("user_spiritzy")).setOption(option1, true);
				echarts.init(document.getElementById("user_spiritzyqs")).setOption(option2, true);
			}
			//接口
			function sportDate(addTime, userId, friendId, token) { //运动
				var url = comLink + "sport/data";
				var data = {
					addTime: addTime,
					userId: userId,
					friendId: friendId,
					token: token
				};
				$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "json",
					success: function(data, status, xhr) {
						if(data.status == '0' || data.msg == '成功') {

							fn_option_sport(addTime, data.data); //数据渲染
						} else {

						}
					},
					error: function(result) {}
				});
			}

			function fn_option_sport(time, data) {

				//页面展示信息
				//评星
				star_sun('.sport_star1', data.scoreTime); //运动时间
				star_sun('.sport_star2', data.scoreStep); //运动步数
				star_sun('.sport_star3', data.scoreStrength); //运动强度

				$(".olState_yd li").html(data.sportCode); //运动状态提示

				//运动状态和心率统计
				if(data.totalNumber) {
					$(' #zbs').html(data.totalNumber)
				} else {
					$(' #zbs').html("---")
				} //总步数
				if(data.validDuration) {
					$(' #yxydsc').html(data.validDuration)
				} else {
					$(' #yxydsc').html("---")
				} //有效运动时长
				if(data.validNumber) {
					$(' #yxydbs').html(data.validNumber)
				} else {
					$(' #yxydbs').html("---")
				} //有效运动步数

				//数据处理
				var last16 = dayList(time).last16; //日期
				var dataTemp = dayList(time).ecShow; //echart日期
				var uesTemp = dayList(time).ecUse; //echart日期下标

				//运动-数据
				var sport1_data1 = [],
					sport1_data2 = [];
				var data_arr1 = data.arrayList;
				if(data_arr1) {
					$.each(last16, function(key, val) { //日期数据比对，生成echart需要数据
						$.each(data_arr1, function(k, v) { //昼夜节律趋势分析
							if(val == v.data_date) {
								sport1_data1[key] = v.valid_number;
								sport1_data2[key] = parseInt(v.total_number) - parseInt(v.valid_number);
							}
						});
					});
					if(sport1_data1.length < 16) {
						sport1_data1[15] = '';
					} //数组不足16个时
					if(sport1_data2.length < 16) {
						sport1_data2[15] = '';
					}
				}
				//运动状态和心率统计
				var useHourTemp = ['0:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '3:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '9:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '12:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '15:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '18:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '21:00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '24:00'];

				if(data.sportData) {
					var sportData = JSON.parse(data.sportData); //步数
				}
				if(data.hrSportData) {
					var hrSportData = JSON.parse(data.hrSportData); //心率
				}

				var ten_minute = [];
				for(var m = 0; m < 145; m++) {
					ten_minute[m] = m * 10;
				}

				var sportDataTxt = []; //文字
				var hrSportDataTxt = []; //文字
				var sport_data1 = []; //步数
				var sport_data2 = []; //心率
				var sport_data2_txt = []; //心率文字

				if(sportData) {
					$.each(sportData, function(key, val) { //步数
						$.each(val, function(k, v) {
							var minutesTemp = Math.floor(k.split(':')[0] * 60) + Math.floor(k.split(':')[1]);
							$.each(ten_minute, function(m, n) {
								if(Math.abs(minutesTemp - n) <= 5) { //小于等于5
									sport_data1[m] = v;
									sportDataTxt[m] = k;
								}
							})
						})
					});
				}

				if(hrSportData) {
					$.each(hrSportData, function(key, val) { //心率
						$.each(val, function(k, v) {
							var minutesTemp = Math.floor(k.split(':')[0] * 60) + Math.floor(k.split(':')[1]);
							$.each(ten_minute, function(m, n) {
								if(Math.abs(minutesTemp - n) <= 5) { //小于等于5
									// sport_data2[m] = v*10;
									sport_data2[m] = v;
									sport_data2_txt[m] = v; //心率文字
									hrSportDataTxt[m] = k;
								}
							})
						})
					});
				}

				if(sport_data1.length < 145) {
					sport_data1[144] = '';
				} //数组不足145个时
				if(sportDataTxt.length < 145) {
					sportDataTxt[144] = '';
				}
				if(sport_data2.length < 145) {
					sport_data2[144] = '';
				}
				if(hrSportDataTxt.length < 145) {
					hrSportDataTxt[144] = '';
				}

				if(sport_data2_txt.length < 145) {
					sport_data2_txt[144] = '';
				}

				if(sport_data2) { //补缺失2位以及以下的不足
					$.each(sport_data2, function(key, val) { //心率
						if(!val && sport_data2[key - 1] && sport_data2[key + 1]) { //缺一位
							sport_data2[key] = (parseInt(sport_data2[key - 1]) + parseInt(sport_data2[key + 1])) / 2
						} else if(!val && sport_data2[key - 1] && sport_data2[key + 2]) { //缺两位
							sport_data2[key] = (parseInt(sport_data2[key - 1]) + parseInt(sport_data2[key + 2])) / 2;
							sport_data2[key + 1] = (parseInt(sport_data2[key - 1]) + parseInt(sport_data2[key + 2])) / 2;
						}
					});
				}

				// 运动0
				var option_yd1 = {
					grid: {
						y: 50,
						x2: 28,
						y2: 30,
						x: 46
					},
					tooltip: { // 提示框
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 95, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp0 = sportDataTxt[params[0].dataIndex];
							var timeTemp1 = hrSportDataTxt[params[0].dataIndex];
							var timeTemp_rate = sport_data2_txt[params[0].dataIndex];

							var timeTemp = '';
							if(timeTemp0) {
								timeTemp = timeTemp0;
							} else if(timeTemp1) {
								timeTemp = timeTemp1;
							} else {
								timeTemp = '--:--:--';
							}
							var res = '<div class="tooltip"><p>' + timeTemp + '</p>';
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(params[i].data) {
										res += '<p class="p_86">步数：' + params[i].data + '</p>'
									} else {
										res += '<p class="p_86">步数：---</p>'
									}
								} else if(i == 1) {
									if(timeTemp_rate) {
										res += '<p class="p_fd">心率：' + timeTemp_rate + '</p>'
									} else {
										res += '<p class="p_fd">心率：---</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},

					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: useHourTemp,
						axisLabel: {
							interval: 17,
							textStyle: {
								color: '#999',
								fontSize: '8'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: [{
						scale: true,
						max: 2000,
						min: 0,
						splitNumber: 5,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					}, {
						scale: true,
						max: 160,
						min: 0,
						interval: 40,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					}],
					color: ['#fd7b52', '#86d9e0'],
					legend: {
						selectedMode: false,
						x: 'left',
						padding: [0, 0, 0, 35],
						itemWidth: 15,
						itemHeight: 6,
						itemGap: 27,
						data: [{
							name: '心率',
							icon: 'rect',
						}, {
							name: '步数',
							icon: 'rect'
						}],
					},
					series: [{
						name: '步数',
						type: 'bar',
						barWidth: 1,
						data: sport_data1,
						itemStyle: {
							normal: {
								color: '#86d9e0'
							}
						},
					}, {
						yAxisIndex: 1,
						name: '心率',
						type: 'line',
						smooth: true,
						data: sport_data2,
						symbol: 'null',
						symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#fd7b52',
									width: 2
								}
							}
						},
					}],
				};

				var option_yd2 = {
					grid: {
						y: 50,
						x2: 14,
						y2: 30,
						x: 50
					},
					tooltip: { // 提示框
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 100, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemp[0] + '月' + timeTemp[1] + '日';
							var res = '<div class="tooltip"><p>' + timeShow + '</p>'
							for(var i = 0; i < params.length; i++) {
								var stepTemp = Math.floor(params[0].data) + Math.floor(params[1].data);
								if(i == 0) {
									if(params[i].data) {
										res += '<p class="p_00">有效步数 ' + params[i].data + '</p>'
									} else {
										res += '<p class="p_00">有效步数 ---</p>'
									}
								} else if(i == 1) {
									if(params[i].data) {
										res += '<p class="p_86">总步数 ' + stepTemp + '</p>'
									} else {
										res += '<p class="p_86">总步数 ---</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					xAxis: {
						type: 'category',
						data: uesTemp,
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						scale: true,
						min: 0,
						splitNumber: 5,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					color: ['#86d9e0', '#0091ea', ],
					legend: { //图例
						selectedMode: false,
						x: 'left',
						padding: [0, 0, 0, 35],
						itemWidth: 15,
						itemHeight: 6,
						itemGap: 27,
						data: [{
							name: '总步数',
							icon: 'rect',
						}, {
							name: '有效步数',
							icon: 'rect'
						}],
					},
					series: [{ //数据
						name: '有效步数',
						type: 'bar',
						stack: '步数',
						barWidth: 6,
						data: sport1_data1,
						itemStyle: {
							normal: {
								color: '#0091ea'
							}
						},
					}, {
						name: '总步数',
						type: 'bar',
						stack: '步数',
						barWidth: 6,
						data: sport1_data2,
						itemStyle: {
							normal: {
								color: '#86d9e0'
							}
						},
					}],
				};
				echarts.init(document.getElementById("user_ssporttj")).setOption(option_yd1, true);
				echarts.init(document.getElementById("user_sportqs")).setOption(option_yd2, true);

			}
			//接口
			function sleepDate(addTime, userId, friendId, token) { //睡眠
				var url = comLink + "sleep/data";
				var data = {
					addTime: addTime,
					userId: userId,
					friendId: friendId,
					token: token
				};
				$.ajax({
					type: "POST",
					url: url,
					data: data,
					dataType: "json",
					success: function(data, status, xhr) {
						if(data.status == '0' || data.msg == '成功') {

							fn_option_sleep(addTime, data.data); //数据渲染
						} else {

						}
					},
					error: function(result) {}
				});
			}

			function fn_option_sleep(time, data) {

				//页面展示信息
				//评星
				star_sun('.sleep_star0', data.scoreTime); //睡眠时间
				star_sun('.sleep_star1', data.scoreDuration); //睡眠时长
				star_sun('.sleep_star2', data.scoreQuality); //睡眠质量
				star_sun('.sleep_star3', data.scoreSpeed); //入睡速度

				$(".olState_sm li").html(data.sleepCode); //睡眠状态提示

				//运动状态和心率统计
				if(data.deepSleep) {
					$(' #smss').html(data.deepSleep)
				} else {
					$(' #smss').html("---")
				} //深睡

				if(data.lightSleep) {
					$(' #smqs').html(data.lightSleep)
				} else {
					$(' #smqs').html("---")
				} //浅睡

				if(data.exception) {
					$(' #smyc').html(data.exception)
				} else {
					$(' #smyc').html("---")
				} //异常

				//睡眠
				var sleepData = JSON.parse(data.sleepData); //睡眠
				var hrSleepData = JSON.parse(data.hrSleepData); //心率

				//睡眠 - 深睡/浅睡/异常
				var len = 0; //深睡/浅睡/异常的时间段长度
				var sleep_data2 = [];
				var sleep_h = [40, 60, 80];
				var sleep_s = ['A', 'B', 'C'];
				if(sleepData) {

					var tm = sleepData[0][0];
					tm = tm.replace(/-/g, ':').replace(' ', ':');
					tm = tm.split(':');
					var tm1 = sleepData[sleepData.length - 1][1];
					tm1 = tm1.replace(/-/g, ':').replace(' ', ':');
					tm1 = tm1.split(':');

					var start_time = new Date(tm[0], (tm[1] - 1), tm[2], tm[3], tm[4], tm[5]).getTime(); //开始时间的时间戳
					var end_time = new Date(tm1[0], (tm1[1] - 1), tm1[2], tm1[3], tm1[4], tm1[5]).getTime(); //结束时间的时间戳
					var len_time = Math.round((end_time - start_time) / 60000); //总的时间段(分钟数)
					//睡眠 - 心率
					var uesHourTemp_sleep = []; //x轴列表
					var len_time_sub = Math.round(len_time / 10); //x轴长度，根据睡眠时长来确定
					var t_s_h = sleepData[0][0].split(' ')[1].split(':')[0]; //开始时间小时
					var t_s_m = sleepData[0][0].split(' ')[1].split(':')[1]; //开始时间分钟
					var t_e_h = sleepData[sleepData.length - 1][1].split(' ')[1].split(':')[0]; //结束时间小时
					var t_e_m = sleepData[sleepData.length - 1][1].split(' ')[1].split(':')[1]; //结束时间分钟

				}

				var tempList = [];
				tempList[0] = Math.floor(t_s_h * 60) + Math.floor(t_s_m);
				for(var i = 1; i < len_time_sub; i++) { //超过1440就是第二天
					var temp = tempList[i - 1]; //需要定义一个变量
					if(temp > 1430) {
						temp = temp - 1440;
					}
					tempList[i] = temp + 10;
				}
				var sleepTxt = [];

				if(sleepData) {
					$.each(tempList, function(key, val) { //时间数据比对，生成echart需要数据
						$.each(sleepData, function(k, v) { //睡眠 - 心率
							var t = v[0].split(' ')[1].split(':');
							var minutesTemp = Math.floor(t[0] * 60) + Math.floor(t[1]);
							var l0 = v[0].split(' ')[1].split(':');
							var l1 = v[1].split(' ')[1].split(':');
							var str = l0[0] + ':' + l0[1] + '-' + l1[0] + ':' + l1[1];
							if(Math.abs(minutesTemp - val) <= 5) { //小于等于5
								sleepTxt[key] = [];
								if(v[2] == 2) {
									sleepTxt[key][0] = '深睡';
								} else if(v[2] == 1) {
									sleepTxt[key][0] = '浅睡';
								} else if(v[2] == 0) {
									sleepTxt[key][0] = '异常';
								} else {
									sleepTxt[key][0] = '数据异常';
								}
								sleepTxt[key][1] = str;
							}
						});
					});
					if(sleepTxt.length < len_time_sub) {
						sleepTxt[len_time_sub - 1] = '';
					}
					$.each(sleepTxt, function(key, val) {
						if(!val) {
							sleepTxt[key] = sleepTxt[key - 1];
						}
					});
				}

				var sleep_data1 = []; //心率
				var sleep_data1_txt = []; //心率文字
				var hourTemp_sleep = []; //心率时间列表
				if(hrSleepData) {
					$.each(tempList, function(key, val) { //时间数据比对，生成echart需要数据
						$.each(hrSleepData, function(k, v) { //睡眠 - 心率
							$.each(v, function(m, n) {
								var minutesTemp = Math.floor(m.split(':')[0] * 60) + Math.floor(m.split(':')[1]);
								if(Math.abs(minutesTemp - val) <= 5) { //小于等于5
									sleep_data1[key] = n;
									sleep_data1_txt[key] = n;
									hourTemp_sleep[key] = m;
								}
							});
						});
					});
					if(sleep_data1.length < len_time_sub) {
						sleep_data1[len_time_sub - 1] = '';
					} //不足量的时候填补空白
					if(hourTemp_sleep.length < len_time_sub) {
						hourTemp_sleep[len_time_sub - 1] = '';
					}

					if(sleep_data1_txt.length < len_time_sub) {
						sleep_data1_txt[len_time_sub - 1] = '';
					}

				}

				if(sleep_data1) { //补缺失2位以及以下的不足
					$.each(sleep_data1, function(key, val) { //心率
						if(!val && sleep_data1[key - 1] && sleep_data1[key + 1]) { //缺一位
							sleep_data1[key] = (parseInt(sleep_data1[key - 1]) + parseInt(sleep_data1[key + 1])) / 2
						} else if(!val && sleep_data1[key - 1] && sleep_data1[key + 2]) { //缺两位
							sleep_data1[key] = (parseInt(sleep_data1[key - 1]) + parseInt(sleep_data1[key + 2])) / 2;
							sleep_data1[key + 1] = (parseInt(sleep_data1[key - 1]) + parseInt(sleep_data1[key + 2])) / 2;
						}
					});
				}

				if(uesHourTemp_sleep) {
					uesHourTemp_sleep[0] = t_s_h + ':' + t_s_m;
					uesHourTemp_sleep[len_time_sub - 1] = t_e_h + ':' + t_e_m;
					for(var i = 1; i < len_time_sub - 1; i++) {
						uesHourTemp_sleep[i] = '';
					}
					var num_interval = len_time_sub - 2;
				}

				if(sleepData) {
					$.each(sleepData, function(key, val) {

						// 时间戳处理
						var tm2 = val[0];
						tm2 = tm2.replace(/-/g, ':').replace(' ', ':');
						tm2 = tm2.split(':');
						var tm3 = val[1];
						tm3 = tm3.replace(/-/g, ':').replace(' ', ':');
						tm3 = tm3.split(':');

						var time0 = new Date(tm2[0], (tm2[1] - 1), tm2[2], tm2[3], tm2[4], tm2[5]).getTime();
						var time1 = new Date(tm3[0], (tm3[1] - 1), tm3[2], tm3[3], tm3[4], tm3[5]).getTime();

						var time = (time1 - time0) / 60000 / len_time * 100; //每个时间段的百分比
						sleep_data2[key] = [];
						sleep_data2[key][0] = len;
						len += time;
						sleep_data2[key][1] = len;
						if(val[2] == 2) {
							sleep_data2[key][2] = sleep_h[0];
							sleep_data2[key][3] = sleep_s[0];
						} else if(val[2] == 1) {
							sleep_data2[key][2] = sleep_h[1];
							sleep_data2[key][3] = sleep_s[1];
						} else if(val[2] == 0) {
							sleep_data2[key][2] = sleep_h[2];
							sleep_data2[key][3] = sleep_s[2];
						}
					});

					sleep_data2[sleep_data2.length - 1][1] = 100; //强制定为100

				}

				//数据处理
				var last16 = dayList(time).last16; //日期
				var dataTemp = dayList(time).ecShow; //echart日期
				var uesTemp = dayList(time).ecUse; //echart日期下标

				//睡眠-数据
				var sleep2_data1 = [],
					sleep2_data2 = [],
					sleep2_data1_show = [],
					sleep2_data2_show = [];
				var data_arr1 = data.arrayList;
				if(data_arr1) {
					$.each(last16, function(key, val) { //日期数据比对，生成echart需要数据
						$.each(data_arr1, function(k, v) { //睡眠趋势分析
							if(val == v.date_data) {
								var deep0 = v.deep_sleep.split('小时')[0];
								var deep1 = v.deep_sleep.split('小时')[1].split('分钟')[0];
								var deep = parseInt(deep0) + parseFloat(deep1 / 60);
								var all0 = v.all_sleep.split('小时')[0];
								var all1 = v.all_sleep.split('小时')[1].split('分钟')[0];
								var all = parseInt(all0) + parseFloat(all1 / 60);
								sleep2_data1[key] = deep;
								sleep2_data2[key] = all - deep;
								sleep2_data1_show[key] = v.deep_sleep;
								sleep2_data2_show[key] = v.all_sleep;
							}
						});
					});
					if(sleep2_data1.length < 16) {
						sleep2_data1[15] = '';
					} //数组不足16个时
					if(sleep2_data2.length < 16) {
						sleep2_data2[15] = '';
					}
					if(sleep2_data1_show.length < 16) {
						sleep2_data1_show[15] = '';
					}
					if(sleep2_data2_show.length < 16) {
						sleep2_data2_show[15] = '';
					}
				}

				// 睡眠
				var option_sleep1 = {
					grid: {
						y: 50,
						x2: 28,
						y2: 30,
						x: 46
					},
					tooltip: { // 提示框
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 120, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容
							var timeTemp = hourTemp_sleep[params[0].dataIndex];
							var timeTemp_txt = sleep_data1_txt[params[0].dataIndex];
							var sleepTemp = sleepTxt[params[0].dataIndex][0] + '：' + sleepTxt[params[0].dataIndex][1];
							if(!timeTemp) {
								timeTemp = '--:--:--'
							}
							var res = '<div><p>时间：' + timeTemp + '</p>'
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(timeTemp_txt) {
										res += '<p>心率：' + timeTemp_txt + '</p>'
									} else {
										res += '<p>心率：---</p>'
									}
								}
							}
							res += '<p>' + sleepTemp + '</p>'
							res += '</div>';
							return res;
						},
					},
					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: uesHourTemp_sleep,
						axisLabel: {
							interval: num_interval,
							textStyle: {
								color: '#999',
								fontSize: '8'
							}
						},
						axisLine: {
							show: false,
							lineStyle: {
								color: '#e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false,
						}
					},
					yAxis: {
						scale: true,
						max: 140,
						min: 0,
						splitNumber: 6,
						type: 'value',
						axisLabel: {
							show: true,
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: false,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					series: [{
						name: '心率',
						type: 'line',
						smooth: true,
						data: sleep_data1,
						symbol: 'null',
						symbolSize: 0,
						itemStyle: {
							normal: {
								lineStyle: {
									color: '#fd7b52'
								}
							}
						},
					}],
				};

				var option_sleep2 = {
					grid: {
						y: 50,
						x2: 14,
						y2: 30,
						x: 50,
					},
					tooltip: {
						trigger: 'axis',
						showDelay: 0,
						hideDelay: 0,
						transitionDuration: 0,
						backgroundColor: '#fff',
						borderColor: '#999',
						borderWidth: 1,
						borderRadius: 4,
						textStyle: {
							color: '#666'
						},
						axisPointer: {
							type: 'line',
							lineStyle: {
								color: '#fd7a51',
								width: 2,
								type: 'solid'
							},
						},
						position: function(p) {
							if(p[0] > 200) {
								return [p[0] - 120, 28];
							} else {
								return [p[0], 28];
							}
						},
						formatter: function(params) { //自定义内容

							var deep_show = sleep2_data1_show[params[0].dataIndex];
							var all_show = sleep2_data2_show[params[0].dataIndex];

							var timeTemp = dataTemp[params[0].dataIndex].split('/');
							var timeShow = timeTemp[0] + '月' + timeTemp[1] + '日';
							var res = '<div class="tooltip"><p>' + timeShow + '</p>'
							for(var i = 0; i < params.length; i++) {
								if(i == 0) {
									if(params[i].data) {
										res += '<p class="p_13">深睡 ' + deep_show + '</p>'
									} else {
										res += '<p class="p_13">深睡 ---</p>'
									}
								} else if(i == 1) {
									if(params[i].data) {
										res += '<p class="p_86">总长 ' + all_show + '</p>'
									} else {
										res += '<p class="p_86">总长 ---</p>'
									}
								}
							}
							res += '</div>';
							return res;
						},
					},
					xAxis: {
						type: 'category',
						data: uesTemp,
						axisLabel: {
							interval: 0,
							textStyle: {
								color: '#999'
							}
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false
						}
					},
					yAxis: {
						// scale: true, min: 0, splitNumber: 5, type: 'value',
						scale: true,
						min: 0,
						interval: 1,
						type: 'value',
						// axisLabel: {show: true, formatter: '{value}小时', textStyle: {color: '#999'}},
						axisLabel: {
							show: true,
							formatter: function(value) {
								// Function formatter
								//return value / 60;
								return value;
							},
							textStyle: {
								color: '#999'
							}
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					color: ['#86d9e0', '#13b5b1'],
					legend: { //图例
						selectedMode: false,
						x: 'left',
						padding: [0, 0, 0, 35],
						itemWidth: 15,
						itemHeight: 6,
						itemGap: 27,
						data: [{
							name: '总长',
							icon: 'rect',
						}, {
							name: '深睡',
							icon: 'rect'
						}],
					},
					series: [{ //数据
						name: '深睡',
						type: 'bar',
						stack: '步数',
						barWidth: 6,
						data: sleep2_data1,
						itemStyle: {
							normal: {
								color: '#13b5b1'
							}
						},
					}, {
						name: '总长',
						type: 'bar',
						stack: '步数',
						barWidth: 6,
						data: sleep2_data2,
						itemStyle: {
							normal: {
								color: '#86d9e0'
							}
						},
					}, ],
				};
				echarts.init(document.getElementById("sleep0")).setOption(option_sleep1, true);
				echarts.init(document.getElementById("sleep1")).setOption(option_sleep2, true);

				sleep(sleep_data2);
			}

			function sleep(sleep_data) {

				var data = sleep_data; //睡眠数据
				var colorList = ['#86d9e0', '#0091ea', '#cfa972'];
				data = echarts.util.map(data, function(item, index) { //添加颜色
					var color;
					if(item[2] == 60) {
						color = colorList[0];
					} else if(item[2] == 40) {
						color = colorList[1];
					} else if(item[2] == 80) {
						color = colorList[2];
					}
					return {
						value: item,
						itemStyle: {
							normal: {
								color: color
							}
						} //颜色
					};
				});

				function renderItem(params, api) {
					var yValue = api.value(2);
					var start = api.coord([api.value(0), yValue]);
					var size = api.size([api.value(1) - api.value(0), yValue]);
					var style = api.style();
					return {
						type: 'rect',
						shape: {
							x: start[0],
							y: start[1],
							width: size[0],
							height: size[1]
						},
						style: style
					};
				};
				var option_sleep3 = {
					grid: {
						y: 50,
						x2: 28,
						y2: 30,
						x: 46,
					},
					tooltip: {
						show: false
					},
					xAxis: {
						scale: true,
						axisLabel: {
							show: false
						},
						splitLine: {
							show: false
						},
						axisLine: {
							lineStyle: {
								color: 'e7e5e4',
							}
						},
						axisTick: {
							show: false
						},
						splitArea: {
							show: false
						}
					},
					yAxis: {
						max: 140,
						min: 0,
						splitNumber: 6,
						axisLabel: {
							show: false
						},
						splitLine: {
							show: true,
							lineStyle: {
								type: 'dotted'
							}
						},
						axisLine: {
							show: false
						},
						axisTick: {
							show: false
						},
					},
					series: [{
						type: 'custom',
						renderItem: renderItem,
						dimensions: ['from', 'to', 'profit'],
						encode: {
							x: [0, 1],
							y: 2,
							tooltip: [0, 1, 2],
							itemName: 3
						},
						data: data
					}]
				};
				echarts.init(document.getElementById("sleep3")).setOption(option_sleep3, true);
			}
		</script>
		<!--脏腑雷达-->
	</body>

</html>